/*
 * BinaryGeneticAlgorithmApplication.cpp
 *
 *  Created on: Oct 17, 2013
 *      Author: filipe
 */
#include "BinaryGeneticAlgorithmParameters.h"
#include "BinaryGeneticAlgorithm.h"
#include <iostream>

using namespace std;

// function to maximize
double
square(double *data)
{
	return (data[0] * data[0]);
}


int
main(void)
{
	double *value_found;

	BinaryGeneticAlgorithmParameters *params = new BinaryGeneticAlgorithmParameters();

	params->SetMaxPermitedValue(10.0);
	params->SetMinPermitedValue(0.0);

	BinaryGeneticAlgorithm optimizer(params, square);

	optimizer.Optimize();
	value_found = optimizer.GetCurrentEstimate();

	cout << value_found[0] << endl;

	return 0;
}



